<div id="menu-container" class="round-all grad-blue">
    <div class="menu-wrap">
        <ul id="admin-menu">

            <li class="menu-item fl">
                <a href="<?php echo $this->url(array('module' => 'admin', 'action' => 'users',), null, true) ?>">
                    Użytkownicy
                </a>
            </li>
            <li class="menu-item fl expandable">
                <a href="<?php echo $this->url(array('module' => 'admin', 'action' => 'content',), null, true) ?>">
                    Treść
                </a>
                <div class="submenu">
                    <div class="submenu_wrap round-all grad-blue">
                    <ul>
                        <li>
                            <a href="<?php echo $this->url(array('module' => 'admin', 'action' => 'categories','filterparentId'=>'0'), null, true) ?>">
                                Kategorie
                            </a>
                        </li>
                    </ul>
                    </div>
                </div>
            </li>
            <li class="menu-item fl">
                <a href="<?php echo $this->url(array('module' => 'admin', 'action' => 'settings',), null, true) ?>">
                    Ustawienia
                </a>
            </li>
            <li class="menu-item fl">
                <a href="<?php echo $this->url(array('module' => 'admin', 'action' => 'logo',), null, true) ?>">
                    Logo
                </a>
            </li>
            <li class="menu-item fl">
                <a href="<?php echo $this->url(array('module' => 'admin', 'action' => 'logout',), null, true) ?>">
                    Wyloguj
                </a>
            </li>
            <li class="cls"></li>
        </ul>
    </div>
</div>
<script type="text/javascript">
    
    var currentMenu = '/<?php echo $this->request->getModuleName() . '/' . $this->request->getControllerName() . '/' . $this->request->getActionName() ?>';
    var params = <?php echo json_encode($this->request->getParams()); ?>;
    
    var match = false;
    var ob = null;
    var obch = [];
    $(function(){
        $('#admin-menu a')
        .each(function(ev){
            if(match)
                return;
            var cur = currentMenu.replace(/\/$/,'');

            if(new RegExp(".*"+cur.replace(/\//ig,"\/")+".*").test(this.href.toString())){
                match = true;
                ob = $(this);
                ob.addClass('active').parent('li').addClass('active');
                
                if(ob.parent('li').hasClass('expandable')){
                    //ob.parent('li').addClass('grad-blue');
                }
                
            }
            
        });
        
        var orderparams = filter(params,function(key,value){
            var r=false;
            if(/order.*/.test(key))
                r=true;
            return r;
        });
        
        $('.sort span').removeClass('active');
        
        for(var i in orderparams){
            var name = 'fieldName'+(i.replace(/order/,''));
            $('.'+name+'.'+orderparams[i]).addClass('active');            
        }
        
    });
    
</script>